/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package javalee.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.JTextField;

/**
 *
 * @author Danilo
 */
public class Uteis {
     public static boolean validaCampoTexto(JTextField j){
        String d = j.getText();
        boolean retorno = true;
        if(!"".equals(j.getText())){
    Pattern p = Pattern.compile("[a-zA-ZçÇáéíóúýÁÉÍÓÚÝàèìòùÀÈÌÒÙãõñäëïöüÿÄËÏÖÜÃÕÑâêîôûÂÊÎÔÛ\\.\\-\\s]+"); 
            Matcher m = p.matcher(d);  
            if (!m.find()){
               j.setText("");
               retorno = false;
            }
        }
            return retorno;
    }
}
